package com.wing.qualityTesting.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wing.productionPlan.model.entity.ProAbnormalCause;
import com.wing.qualityTesting.model.entity.QualityTestingRecord;
import com.wing.qualityTesting.model.request.QualityRecordAddOrUpdateForm;
import com.wing.qualityTesting.model.request.QualityTestingRecordForm;
import com.wing.qualityTesting.model.response.*;

import java.util.List;
import java.util.Map;

/**
 * 质检记录表-Service
 *
 * @author
 */
public interface QualityTestingRecordService extends IService<QualityTestingRecord> {

    /**
     * 添加
     *
     * @param qualityTestingRecordForm
     * @return
     */
    int add(QualityTestingRecordForm qualityTestingRecordForm);

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<QualityTestingRecordVO> list4app(Map<String, Object> params);

    /**
     * 分页list-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    Page<QualityTestingRecordVO> pageList4app(Page page, Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    QualityTestingRecordVO get4appById(Long id);

    /**
     * 查询质检任务和工单信息
     *
     * @param taskId
     *
     * @return
     */
    WorkOrderQualityTestingTaskVO getTestingTaskByTaskId(Long taskId);

    /**
     * 查询质检结果需要的数据
     * @param taskId
     * @return
     */
    List<ProcessQualityVO> getInspectionResultsData(Long taskId);

    void submitTestingRecord(QualityTestingRecordForm qualityTestingRecordForm);

    /**
     * 添加质检记录 new
     * @param qualityTestingRecordForm
     * @return
     */
    int addQualityDetail(QualityRecordAddOrUpdateForm qualityTestingRecordForm);

    /**
     * 查询 任务记录下的样品配置
     * @param recordId
     * @param processId
     * @return
     */
    List<QualityRecordDetailInfoVo> getRecordResultsData(Long recordId,Long processId);

    /**
     * 修改样品配置信息
     * @param qualityTestingRecordForm
     * @return
     */
    int updateQualityDetail(QualityRecordAddOrUpdateForm qualityTestingRecordForm);

    /**
     * 根据任务id查询出质检参数信息
     * @param taskId
     * @param recordDetailId
     * @return
     */
    QualityDetailRecordInfoVo getDetailRecordValue(Long taskId, Long recordDetailId,Long bookId);

    /**
     * 提交置间结果信息
     * @param simpleVo
     * @return
     */
    int submitResultValue(QualityDetailRecordSimpleVo simpleVo);

    /**
     * 查询任务基本信息
     * @param taskId
     * @return
     */
    QualityTaskDetailRecordVo getTaskDetailRecord(Long taskId);

    /**
     *
     * @param pg
     * @param paramMap
     * @return
     */
    IPage<QualityTestingRecordDetailSearchVO> pageList4appNew(Page<QualityTestingRecordDetailSearchVO> pg, Map paramMap);

    /**
     * 关闭质检任务
     * @param id
     * @return
     */
    int close(Long id);

    /**
     * 获取开工单错误信息
     */
    List<ProAbnormalCause> getAbnormalCauseBy(Long workOrderId);
}
